package com.jack.vipmis.vip.jpush.service;

import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;

import com.jack.vipmis.common.entity.search.SearchOperator;
import com.jack.vipmis.common.entity.search.SearchRequest;
import com.jack.vipmis.common.entity.search.Searchable;
import com.jack.vipmis.common.service.BaseService;
import com.jack.vipmis.vip.jpush.entity.PushResources;
import com.jack.vipmis.vip.jpush.repository.PushResourcesRepository;

/**
 * 
 * @author JackLiang
 * @version 1.0
 * @date 2014-6-25
 */
@Service
public class PushResourcesService extends BaseService<PushResources, Long> {

	private PushResourcesRepository getPushResourcesRepository() {
		return (PushResourcesRepository) baseRepository;
	}

	/**
	 * 获取最新消息列表
	 */
	public List<PushResources> list() {
		Searchable sc = SearchRequest.newSearchable();
		sc.addSearchFilter("createTime", SearchOperator.eq, new Date());
		return getPushResourcesRepository().findAll(sc).getContent();
	}
}
